# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=colord
pkgver=1.4.4
pkgrel=6
pkgdesc="System daemon for managing color devices"
url="http://www.freedesktop.org/software/colord"
arch="all"
license="GPL-2.0-or-later"
pkgusers="colord"
pkggroups="colord"
depends_dev="dconf-dev dbus-dev gobject-introspection-dev sqlite-dev
	polkit-dev eudev-dev libgudev-dev vala sane-dev"
makedepends="$depends_dev meson intltool bash-completion libgusb-dev lcms2-dev"
subpackages="
	$pkgname-dev
	$pkgname-lang
	$pkgname-bash-completion:bashcomp:noarch
	"
source="https://www.freedesktop.org/software/colord/releases/colord-$pkgver.tar.xz
	disable-udev-hwdb-tests.patch"
install="colord.pre-install colord.pre-upgrade"

build() {
	meson \
		--prefix=/usr \
		--buildtype=plain \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		-Dsystemd=false \
		-Dargyllcms_sensor=false \
		-Dman=false \
		-Ddocs=false \
		-Ddaemon_user=colord \
		-Dsane=true \
		-Dvapi=true \
		output .

	ninja -C output
}

check() {
	# cd-private-test is broken atm
	# meson test

	output/src/cd-self-test
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
	chown -R colord:colord "$pkgdir"/var/lib/colord
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion/completions
}

sha512sums="0187a363c41ae5102dc3b454fcd84df83d71ac0dc32d88b33651edc1df15cbf1f47218caee3037c876e892613a2301226886a73b39759cfb709d0fef8e168628  colord-1.4.4.tar.xz
4e306254902658ffe0904b4ee3fdc10c473af909662c08fc66b9070fd698e07e1f804e53ccd94160ac57d268269132683808ff8f2bae64fd2a9070d6f024b800  disable-udev-hwdb-tests.patch"
